package org.systemsbiology.rface.pojos;

import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by IntelliJ IDEA.
 * User: aeakin
 * Date: Jul 26, 2011
 * Time: 10:24:08 AM
 * To change this template use File | Settings | File Templates.
 */
public class RFACEBean {

    private final String uri;
    private final String node;

    public RFACEBean(HttpServletRequest request){
          this.uri = request.getRequestURI();
          String nodeUri = StringUtils.substringAfterLast(this.uri,"node/");
          if(nodeUri != null && !nodeUri.isEmpty()){
              System.out.println("nodeUri: " + nodeUri);
            String[] splits = nodeUri.split("/");
            if(splits.length > 0){
                this.node = splits[0].replaceAll("%20"," ");
            }else{
                this.node="";
            }

          }
        else this.node="";
    }

    public String getUri(){
        return uri;

    }

    public String getNode(){
        return node;
    }

}
